# coding=utf-8
import arcpy
path = r'D:\Test';
arcpy.env.workspace = path
shp = r'D:\Test\t2\m_riv.shp'.decode('utf-8')
cs1 = arcpy.da.SearchCursor(shp,['SHAPE@','name'])

shp2 = r'D:\Test\t2\r1.shp'.decode('utf-8')
cs2 = arcpy.da.SearchCursor(shp2,['SHAPE@','name'])

for row1 in cs1:
    rivMain = row1[0]
    for row2 in cs2:
        print row2[1],row2[0].touches(rivMain)

# for row1 in cs1:
#     name=row1[1]
#     state = 0
#     for row2 in cs2:
#         if row2[0].contains(row1[0].lastPoint):
#             print "A"
#             state += 1
#     cs2.reset()
#     if state != 1:
#         print name
        # if row2[0].contains(row1[0].lastPoint):
        #     print "AAA"
        #     state += 1
    # if state != 1:
    #     print name
    # riv = row1[0]
    # contains = 0
    # for row2 in cs2:
    #     if not riv.contains(row2[0].lastPoint):
    #         contains += 1
    #         print row2[1],"NG"
    # cs2.reset()
    # if contains != 1:
    #     print row1[1]+"********"
    # i+=1